SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE [dbo].[paReservarNumeroDeNorma]
@NumeroDeNorma VARCHAR(10) OUTPUT
AS

SET NOCOUNT ON
-- SE OBTIENE LA ULTIMA NORMA
SELECT @NumeroDeNorma = CONVERT(VARCHAR, UltimaNorma) + '-' + CONVERT(VARCHAR, Anio) FROM tb_MovimientosDocentes WHERE Mnemo = 'T'

-- SE ACTUALIZA LA COLA
UPDATE tb_MovimientosDocentes SET UltimaNorma = UltimaNorma + 1 WHERE Mnemo = 'T'
GO
GRANT EXECUTE ON  [dbo].[paReservarNumeroDeNorma] TO [PersonalDocente]
GO
